<?php
class Invoice {
	/**
	 * holds InvoiceComponents
	 * @var array
	 */
	protected $_components;
	
	/**
	 * completes the sale
	 * @return 
	 */
	public function completeSale() {
		foreach($this->_components as $component) {
			$component->sell();
		}
	}
	
	/**
	 * adds a new product
	 * @param object $_product
	 * @param object $_quantity
	 * @return 
	 */
	public function addProduct($_product, $_quantity) {
		$this->_components[] = new InvoiceComponent($_product, $_quantity);
	}
}